package titt.server.func.util;

import titt.head.HeadFactory;
import titt.head.request.MethodHead;
import titt.head.response.ResponseHead;
import titt.io.socket.TITTSocket;
import titt.io.writer.ResponseWriter;
import titt.key.TITTKey;
import titt.server.func.TITTFunction;
import titt.server.os.ObjectServer;
import titt.type.TypedObject;
import titt.type.Types;

public class Gensym implements TITTFunction {
	
	@Override
	public String getMethodName() {
		return "gensym";
	}

	@Override
	public void handle(TITTKey key, MethodHead head, TITTSocket ts,
			ObjectServer os) throws Exception {

		ResponseWriter rw = new ResponseWriter(ts, os.getEncodingFacade(), new ResponseHead(200, HeadFactory.EMPTY));
		rw.writeValues(new TypedObject(Types.STRING, "s"+os.generateID(false)));
		
		ts.close();

	}

}
